package com.wang.yupao.service;

import com.wang.yupao.model.domain.Team;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.yupao.model.domain.User;
import com.wang.yupao.model.dto.TeamGetQuery;
import com.wang.yupao.model.dto.TeamQuery;
import com.wang.yupao.model.request.TeamJoinRequest;
import com.wang.yupao.model.request.TeamQuitRequest;
import com.wang.yupao.model.request.TeamUpdateRequest;
import com.wang.yupao.model.vo.TeamUserVO;

import java.util.List;

/**
 * @author 胡歌的腿毛
 * @description 针对表【team(队伍表)】的数据库操作Service
 * @createDate 2023-05-25 20:31:07
 */
public interface TeamService extends IService<Team> {

    /**
     * 创建队伍
     *
     * @param team
     * @return
     */
    long addTeam(Team team, User loginUser);

    /**
     * 搜索队伍
     *
     * @param teamQuery
     * @return
     */
    List<TeamUserVO> listTeam(TeamQuery teamQuery, boolean isAdmin);

    /**
     * 修改队伍信息
     *
     * @param teamUpdateRequest
     * @param loginUser
     * @return
     */
    boolean updateTeam(TeamUpdateRequest teamUpdateRequest, User loginUser);

    /**
     * 加入队伍
     *
     * @param teamJoinRequest
     * @param loginUser
     * @return
     */
    boolean joinTeam(TeamJoinRequest teamJoinRequest, User loginUser);

    /**
     * 退出队伍
     *
     * @param teamQuitRequest
     * @param loginUser
     * @return
     */
    boolean quitTeam(TeamQuitRequest teamQuitRequest, User loginUser);

    /**
     * 解散队伍
     *
     * @param id
     * @param loginUser
     */
    boolean deleteTeam(long id, User loginUser);

    /**
     * 返回当前更新队伍的队伍信息
     *
     * @param id
     * @return
     */
    TeamGetQuery getUpdateTeamById(long id);

    /**
     * 获取我创建的队伍
     *
     * @param loginUser
     * @return
     */
    List<TeamUserVO> getMyCreateTeam(User loginUser, String searchText);

    /**
     * 获取我加入的队伍
     *
     * @param loginUser
     * @param searchText
     * @return
     */
    List<TeamUserVO> getMyJoinTeam(User loginUser, String searchText);
}
